#pragma once

namespace GameConstants
{
	// bounds of the arena
	static const DirectX::XMFLOAT3 MinBound	= DirectX::XMFLOAT3( 0.0f,  0.0f,  0.0f);
	static const DirectX::XMFLOAT3 MaxBound	= DirectX::XMFLOAT3(19.0f, 10.0f, 90.0f);

	// game camera "look at" points
	static const DirectX::XMFLOAT3 LookAtP1	= DirectX::XMFLOAT3(9.5f, 5.0f, 90.0f);
	static const DirectX::XMFLOAT3 LookAtP2	= DirectX::XMFLOAT3(9.5f, 5.0f,  0.0f);

	// Waiting Room camera positions
	static const DirectX::XMFLOAT3 WaitingEyeP1				= DirectX::XMFLOAT3(GameConstants::MaxBound.x/2, GameConstants::MaxBound.y/2, GameConstants::MaxBound.z - 12.0f);
	static const DirectX::XMFLOAT3 WaitingEyeP2				= DirectX::XMFLOAT3(GameConstants::MaxBound.x/2, GameConstants::MaxBound.y/2, GameConstants::MinBound.z + 12.0f);
	static const DirectX::XMFLOAT3 WaitingEyeMjpegStation	= DirectX::XMFLOAT3(GameConstants::MaxBound.x/2, GameConstants::MaxBound.y/2, GameConstants::MinBound.z + 9.6f);

	// game camera eye position
	static const DirectX::XMFLOAT3 EyeP1		= DirectX::XMFLOAT3(GameConstants::MaxBound.x/2, GameConstants::MaxBound.y/2, GameConstants::MinBound.z - 6.0f);
	static const DirectX::XMFLOAT3 EyeP2		= DirectX::XMFLOAT3(GameConstants::MaxBound.x/2, GameConstants::MaxBound.y/2, GameConstants::MaxBound.z + 6.0f);

	// game results -> waiting room transition time
	static const float ResetTimer	= 10.0f;

	// how long puck sits on paddle before launching
	static const float PuckLaunchTimer	= 2.0f;

	// when pucks split, factor to offset split pucks velocity
	static const float SplitPuckVelocityFactor = 5.0f;

	// maximum number of pucks in play
	static const int MaxPucks			= 3;

	// which puck in the array is the "main" play puck?
	static const int MainPuck			= 2;

	// maximum speed of any puck
	static const float MaxPuckSpeed		= 70.0f;

	// maximum speed of any puck
	static const float MinPuckSpeed		= 20.0f;

	// number of wall segments ( NumWallSegments * WallSegmentDepth == MaxBound.z )
	static const int NumWallSegments	= 9;

	// length of a wall segment
	static const float WallSegmentDepth	= 10.0f;

	// length of a light
	static const float LightDepth		= WallSegmentDepth - 0.2f;

	// paddle positions
	static const float Paddle1Position	= MinBound.z + 5.0f;
	static const float Paddle2Position	= MaxBound.z - 5.0f;

	namespace PaddlePower
	{
		// power level to light paddle at maximum color
		static const float Max					= 9.0f;

		// max paddle power color...each component will be multiplied by power factor
		static const DirectX::XMFLOAT4 Color	= DirectX::XMFLOAT4(0.2f, 0.4f, 0.7f, 0.5f);
	
		// factor to multiply mesh percentage based on power
		static const float MeshPercent			= 1.2f;
	};

	// time to cycle powerups
	namespace Powerup
	{
		namespace Split
		{
			static const float Time						= 10.0f;
			static const float NumTiles					= 4;
			static const DirectX::XMFLOAT4 TileColor	= DirectX::XMFLOAT4(0.1f, 0.4f, 1.0f, 1.0f);
			static const float TileFadeUp				= 0.20f;
			static const float TileDuration				= 2.10f;
			static const float TileFadeDown				= 0.20f;
			static const float TileMeshPercent			= 2.0f;
			static const float TileDiffusePercent		= 2.0f;
		};
	};

	namespace Audio
	{
		static const float MusicVolume	= 0.3f;
		static const float SfxVolume	= 1.0f;
	};

	// used for music transitions
	static const int LowScore		= 0;
	static const int MediumScore	= 3;
	static const int HighScore		= 5;
	static const int MaxScore		= 7;


	// GROUPING LIGHT VALUES TO MAKE IT EASIER TO TWEAK

	static const DirectX::XMFLOAT4 AmbientColor = DirectX::XMFLOAT4(0.5f, 0.5f, 0.5f, 1.0f);

	namespace BloomValues
	{
		// The brightness of each pixel is reinterpreted from RGBA to a float between 0.0f (black) and 1.0f (white). Values below
		// this threshold are not incorporated into the brightness texture. Since the paddles are translucent, we disregard the 
		// alpha value when determining if a pixel meets the threshold (see BloomExtractPixelShader.hlsl).
		const float ThresholdHigh = 0.9f;
		const float ThresholdLow = 0.76f;

		// This controls how much the brightness texture is blurred (which in turn dictates how much glow surrounds a bloomed area).
		const float BlurAmount = 2.2f;

		// The intensity level for the bloom texture values in the final combined output.
		const float BloomIntensity = 2.0f;
		// The saturation level for the bloom texture values in the final combined output.
		const float BloomSaturation = 1.1f;

		// The intensity level for the original rendered scene's color values in the final combined output.
		const float BaseIntensity = 0.7f;
		// The saturation level for the original rendered scene's color values in the final combined output.
		const float BaseSaturation = 1.2f;

		// To disable bloom, set this to false.
		const bool ApplyBloom = true;
	}

	namespace Countdown
	{
		static const DirectX::XMFLOAT4 LightOnColor	= DirectX::XMFLOAT4(1.0f, 1.0f, 1.0f, 1.0f);
		static const float FadeUpTime				= 0.1f;
		static const float FadeDownTime				= 0.1f;
	};

	namespace GameResults
	{
		static const DirectX::XMFLOAT4 WinColor		= DirectX::XMFLOAT4(0.2f, 1.0f, 0.3f, 1.0f);
		static const DirectX::XMFLOAT4 LoseColor	= DirectX::XMFLOAT4(1.0f, 0.1f, 0.2f, 1.0f);
		static const float FadeUpTime				= 0.10f;
		static const float Duration					= 0.40f;
		static const float FadeDownTime				= 0.10f;
	}

	namespace Damage
	{
		static const DirectX::XMFLOAT4 Color		= DirectX::XMFLOAT4(1.0f, 0.0f, 0.0, 1.0f);
		static const float FadeUpTime				= 0.05f;
		static const float Duration					= 0.50f;
		static const float FadeDownTime				= 0.10f;
		static const float ColorMaxPercent			= 0.65f;
		static const float DiffuseMinPercent		= 0.65f;
		static const float DamageDuration			= 2.0f;
	};

	namespace PaddlePulse
	{
		static const DirectX::XMFLOAT4 Color		= DirectX::XMFLOAT4(1.0f, 1.0f, 1.0f, 1.0f);
		static const float FadeUpTime				= 0.05f;
		static const float Duration					= 0.30f;
		static const float FadeDownTime				= 0.10f;
	};

	namespace Materials
	{
		static const DirectX::XMFLOAT4 WallLightColor	= DirectX::XMFLOAT4(1.0f, 1.0f, 1.0f, 1.0f);
		static const DirectX::XMFLOAT4 PaddleColor		= DirectX::XMFLOAT4(1.0f, 1.0f, 1.0f, 0.9f);
		static const float MjpegSpecularExponent		= 25.0f;
	};

	namespace Particles
	{
		static const bool Enabled					= true;
		static const uint32 ParticleCount			= 300;
		// How many 64x64 textures there are in the 512x512 texture.
		static const uint32 SubTextureCount			= 6;
		static const float SpecularPower			= 0.6f;
		// How fast the particles move toward the player
		static const float TranslationAmount		= 40.0f;
		// How far from the player the particles start.
		static const float StartDepthOffset			= 18.0f;
		// Additive value used in randomly positioning particles. 0.0f sets all particles to start at the same depth.
		static const float MaxStartingDepth			= 4.0f;
	};
};